
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>TypeScript 2.7 · TypeScript Handbook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Patrick Zhong">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="TypeScript 2.6.html" />
    
    
    <link rel="prev" href="TypeScript 2.8.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../handbook/tutorials/">
            
                <a href="../handbook/tutorials/">
            
                    
                    快速上手
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../handbook/tutorials/TypeScript in 5 minutes.html">
            
                <a href="../handbook/tutorials/TypeScript in 5 minutes.html">
            
                    
                    5分钟了解TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../handbook/tutorials/ASP.NET Core.html">
            
                <a href="../handbook/tutorials/ASP.NET Core.html">
            
                    
                    ASP.NET Core
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../handbook/tutorials/ASP.NET 4.html">
            
                <a href="../handbook/tutorials/ASP.NET 4.html">
            
                    
                    ASP.NET 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../handbook/tutorials/Gulp.html">
            
                <a href="../handbook/tutorials/Gulp.html">
            
                    
                    Gulp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../handbook/tutorials/Knockout.html">
            
                <a href="../handbook/tutorials/Knockout.html">
            
                    
                    Knockout.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../handbook/tutorials/React & Webpack.html">
            
                <a href="../handbook/tutorials/React & Webpack.html">
            
                    
                    React与webpack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../handbook/tutorials/React.html">
            
                <a href="../handbook/tutorials/React.html">
            
                    
                    React
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../handbook/tutorials/Angular 2.html">
            
                <a href="../handbook/tutorials/Angular 2.html">
            
                    
                    Angular 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../handbook/tutorials/Migrating from JavaScript.html">
            
                <a href="../handbook/tutorials/Migrating from JavaScript.html">
            
                    
                    从JavaScript迁移到TypeScript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../handbook/">
            
                <a href="../handbook/">
            
                    
                    手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../handbook/Basic Types.html">
            
                <a href="../handbook/Basic Types.html">
            
                    
                    基础类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../handbook/Variable Declarations.html">
            
                <a href="../handbook/Variable Declarations.html">
            
                    
                    变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../handbook/Interfaces.html">
            
                <a href="../handbook/Interfaces.html">
            
                    
                    接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../handbook/Classes.html">
            
                <a href="../handbook/Classes.html">
            
                    
                    类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../handbook/Functions.html">
            
                <a href="../handbook/Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../handbook/Generics.html">
            
                <a href="../handbook/Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../handbook/Enums.html">
            
                <a href="../handbook/Enums.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../handbook/Type Inference.html">
            
                <a href="../handbook/Type Inference.html">
            
                    
                    类型推论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../handbook/Type Compatibility.html">
            
                <a href="../handbook/Type Compatibility.html">
            
                    
                    类型兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../handbook/Advanced Types.html">
            
                <a href="../handbook/Advanced Types.html">
            
                    
                    高级类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../handbook/Utilit Types.md">
            
                <span>
            
                    
                    实用工具类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../handbook/Symbols.html">
            
                <a href="../handbook/Symbols.html">
            
                    
                    Symbols
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../handbook/Iterators and Generators.html">
            
                <a href="../handbook/Iterators and Generators.html">
            
                    
                    Iterators 和 Generators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="../handbook/Modules.html">
            
                <a href="../handbook/Modules.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="../handbook/Namespaces.html">
            
                <a href="../handbook/Namespaces.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="../handbook/Namespaces and Modules.html">
            
                <a href="../handbook/Namespaces and Modules.html">
            
                    
                    命名空间和模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="../handbook/Module Resolution.html">
            
                <a href="../handbook/Module Resolution.html">
            
                    
                    模块解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="../handbook/Declaration Merging.html">
            
                <a href="../handbook/Declaration Merging.html">
            
                    
                    声明合并
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="../handbook/Writing Definition Files.html">
            
                <a href="../handbook/Writing Definition Files.html">
            
                    
                    书写.d.ts文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="../handbook/JSX.html">
            
                <a href="../handbook/JSX.html">
            
                    
                    JSX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="../handbook/Decorators.html">
            
                <a href="../handbook/Decorators.html">
            
                    
                    Decorators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="../handbook/Mixins.html">
            
                <a href="../handbook/Mixins.html">
            
                    
                    混入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="../handbook/Triple-Slash Directives.html">
            
                <a href="../handbook/Triple-Slash Directives.html">
            
                    
                    三斜线指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="../handbook/Type Checking JavaScript Files.html">
            
                <a href="../handbook/Type Checking JavaScript Files.html">
            
                    
                    JavaScript文件里的类型检查
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../handbook/declaration files/Introduction.html">
            
                <a href="../handbook/declaration files/Introduction.html">
            
                    
                    如何书写声明文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../handbook/declaration files/Library Structures.html">
            
                <a href="../handbook/declaration files/Library Structures.html">
            
                    
                    结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../handbook/declaration files/Do's and Don'ts.html">
            
                <a href="../handbook/declaration files/Do's and Don'ts.html">
            
                    
                    规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../handbook/declaration files/By Example.html">
            
                <a href="../handbook/declaration files/By Example.html">
            
                    
                    举例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../handbook/declaration files/Deep Dive.html">
            
                <a href="../handbook/declaration files/Deep Dive.html">
            
                    
                    深入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../handbook/declaration files/Publishing.html">
            
                <a href="../handbook/declaration files/Publishing.html">
            
                    
                    发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../handbook/declaration files/Consumption.html">
            
                <a href="../handbook/declaration files/Consumption.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../handbook/tsconfig.json.html">
            
                <a href="../handbook/tsconfig.json.html">
            
                    
                    工程配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../handbook/tsconfig.json.html">
            
                <a href="../handbook/tsconfig.json.html">
            
                    
                    tsconfig.json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../handbook/Project References.html">
            
                <a href="../handbook/Project References.html">
            
                    
                    工程引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../handbook/Typings for NPM Packages.html">
            
                <a href="../handbook/Typings for NPM Packages.html">
            
                    
                    NPM包的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../handbook/Compiler Options.html">
            
                <a href="../handbook/Compiler Options.html">
            
                    
                    编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../handbook/Configuring Watch.html">
            
                <a href="../handbook/Configuring Watch.html">
            
                    
                    配置 Watch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../handbook/Compiler Options in MSBuild.html">
            
                <a href="../handbook/Compiler Options in MSBuild.html">
            
                    
                    在MSBuild里使用编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../handbook/Integrating with Build Tools.html">
            
                <a href="../handbook/Integrating with Build Tools.html">
            
                    
                    与其它构建工具整合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../handbook/Nightly Builds.html">
            
                <a href="../handbook/Nightly Builds.html">
            
                    
                    使用TypeScript的每日构建版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../wiki/">
            
                <a href="../wiki/">
            
                    
                    Wiki
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../wiki/this-in-TypeScript.html">
            
                <a href="../wiki/this-in-TypeScript.html">
            
                    
                    TypeScript里的this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../wiki/coding_guidelines.html">
            
                <a href="../wiki/coding_guidelines.html">
            
                    
                    编码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../wiki/Common Errors.html">
            
                <a href="../wiki/Common Errors.html">
            
                    
                    常见编译错误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../wiki/TypeScript-Editor-Support.html">
            
                <a href="../wiki/TypeScript-Editor-Support.html">
            
                    
                    支持TypeScript的编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                <a href="../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                    
                    结合ASP.NET v5使用TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../wiki/Architectural-Overview.html">
            
                <a href="../wiki/Architectural-Overview.html">
            
                    
                    架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../wiki/Roadmap.html">
            
                <a href="../wiki/Roadmap.html">
            
                    
                    发展路线图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="./">
            
                <a href="./">
            
                    
                    新增功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="TypeScript 3.1.html">
            
                <a href="TypeScript 3.1.html">
            
                    
                    TypeScript 3.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="TypeScript 3.0.html">
            
                <a href="TypeScript 3.0.html">
            
                    
                    TypeScript 3.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="TypeScript 2.9.html">
            
                <a href="TypeScript 2.9.html">
            
                    
                    TypeScript 2.9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="TypeScript 2.8.html">
            
                <a href="TypeScript 2.8.html">
            
                    
                    TypeScript 2.8
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.7.5" data-path="TypeScript 2.7.html">
            
                <a href="TypeScript 2.7.html">
            
                    
                    TypeScript 2.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="TypeScript 2.6.html">
            
                <a href="TypeScript 2.6.html">
            
                    
                    TypeScript 2.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="TypeScript 2.5.html">
            
                <a href="TypeScript 2.5.html">
            
                    
                    TypeScript 2.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="TypeScript 2.4.html">
            
                <a href="TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="TypeScript 2.3.html">
            
                <a href="TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="TypeScript 2.2.html">
            
                <a href="TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="TypeScript 2.1.html">
            
                <a href="TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.12" data-path="TypeScript 2.0.html">
            
                <a href="TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.13" data-path="TypeScript 1.8.html">
            
                <a href="TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.14" data-path="TypeScript 1.7.html">
            
                <a href="TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.15" data-path="TypeScript 1.6.html">
            
                <a href="TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.16" data-path="TypeScript 1.5.html">
            
                <a href="TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.17" data-path="TypeScript 1.4.html">
            
                <a href="TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.18" data-path="TypeScript 1.3.html">
            
                <a href="TypeScript 1.3.html">
            
                    
                    TypeScript 1.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.19" data-path="TypeScript 1.1.html">
            
                <a href="TypeScript 1.1.html">
            
                    
                    TypeScript 1.1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../breaking-changes/breaking-changes.html">
            
                <a href="../breaking-changes/breaking-changes.html">
            
                    
                    Breaking Changes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../breaking-changes/TypeScript 2.4.html">
            
                <a href="../breaking-changes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../breaking-changes/TypeScript 2.3.html">
            
                <a href="../breaking-changes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../breaking-changes/TypeScript 2.2.html">
            
                <a href="../breaking-changes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../breaking-changes/TypeScript 2.1.html">
            
                <a href="../breaking-changes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../breaking-changes/TypeScript 2.0.html">
            
                <a href="../breaking-changes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../breaking-changes/TypeScript 1.8.html">
            
                <a href="../breaking-changes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../breaking-changes/TypeScript 1.7.html">
            
                <a href="../breaking-changes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../breaking-changes/TypeScript 1.6.html">
            
                <a href="../breaking-changes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../breaking-changes/TypeScript 1.5.html">
            
                <a href="../breaking-changes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="../breaking-changes/TypeScript 1.4.html">
            
                <a href="../breaking-changes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >TypeScript 2.7</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="typescript-27">TypeScript 2.7</h1>
<h2 id="&#x66F4;&#x4E25;&#x683C;&#x7684;&#x7C7B;&#x5C5E;&#x6027;&#x68C0;&#x67E5;">&#x66F4;&#x4E25;&#x683C;&#x7684;&#x7C7B;&#x5C5E;&#x6027;&#x68C0;&#x67E5;</h2>
<p>TypeScript 2.7&#x5F15;&#x5165;&#x4E86;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x63A7;&#x5236;&#x4E25;&#x683C;&#x6027;&#x7684;&#x6807;&#x8BB0;<code>--strictPropertyInitialization</code>&#xFF01;</p>
<p>&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x6807;&#x8BB0;&#x4F1A;&#x786E;&#x4FDD;&#x7C7B;&#x7684;&#x6BCF;&#x4E2A;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027;&#x90FD;&#x4F1A;&#x5728;&#x6784;&#x9020;&#x51FD;&#x6570;&#x91CC;&#x6216;&#x4F7F;&#x7528;&#x5C5E;&#x6027;&#x521D;&#x59CB;&#x5316;&#x5668;&#x8D4B;&#x503C;&#x3002;
&#x5728;&#x67D0;&#x79CD;&#x610F;&#x4E49;&#x4E0A;&#xFF0C;&#x5B83;&#x4F1A;&#x660E;&#x786E;&#x5730;&#x8FDB;&#x884C;&#x4ECE;&#x53D8;&#x91CF;&#x5230;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027;&#x7684;&#x8D4B;&#x503C;&#x68C0;&#x67E5;&#x3002;&#x6BD4;&#x5982;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">class</span> C {
    foo: <span class="hljs-built_in">number</span>;
    bar = <span class="hljs-string">&quot;hello&quot;</span>;
    baz: <span class="hljs-built_in">boolean</span>;
<span class="hljs-comment">//  ~~~</span>
<span class="hljs-comment">//  Error! Property &apos;baz&apos; has no initializer and is not assigned directly in the constructor.</span>
    <span class="hljs-keyword">constructor</span>() {
        <span class="hljs-keyword">this</span>.foo = <span class="hljs-number">42</span>;
    }
}
</code></pre>
<p>&#x4E0A;&#x4F8B;&#x4E2D;&#xFF0C;<code>baz</code>&#x4ECE;&#x672A;&#x88AB;&#x8D4B;&#x503C;&#xFF0C;&#x56E0;&#x6B64;TypeScript&#x62A5;&#x9519;&#x4E86;&#x3002;
&#x5982;&#x679C;&#x6211;&#x4EEC;&#x7684;&#x672C;&#x610F;&#x5C31;&#x662F;&#x8BA9;<code>baz</code>&#x53EF;&#x4EE5;&#x4E3A;<code>undefined</code>&#xFF0C;&#x90A3;&#x4E48;&#x5E94;&#x8BE5;&#x58F0;&#x660E;&#x5B83;&#x7684;&#x7C7B;&#x578B;&#x4E3A;<code>boolean | undefined</code>&#x3002;</p>
<p>&#x5728;&#x67D0;&#x4E9B;&#x573A;&#x666F;&#x4E0B;&#xFF0C;&#x5C5E;&#x6027;&#x4F1A;&#x88AB;&#x95F4;&#x63A5;&#x5730;&#x521D;&#x59CB;&#x5316;&#xFF08;&#x4F7F;&#x7528;&#x8F85;&#x52A9;&#x65B9;&#x6CD5;&#x6216;&#x4F9D;&#x8D56;&#x6CE8;&#x5165;&#x5E93;&#xFF09;&#x3002;
&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x5C5E;&#x6027;&#x4E0A;&#x4F7F;&#x7528;<em>&#x663E;&#x5F0F;&#x8D4B;&#x503C;&#x65AD;&#x8A00;</em>&#x6765;&#x5E2E;&#x52A9;&#x7C7B;&#x578B;&#x7CFB;&#x7EDF;&#x8BC6;&#x522B;&#x7C7B;&#x578B;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">class</span> C {
    foo!: <span class="hljs-built_in">number</span>;
    <span class="hljs-comment">// ^</span>
    <span class="hljs-comment">// Notice this exclamation point!</span>
    <span class="hljs-comment">// This is the &quot;definite assignment assertion&quot; modifier.</span>
    <span class="hljs-keyword">constructor</span>() {
        <span class="hljs-keyword">this</span>.initialize();
    }

    initialize() {
        <span class="hljs-keyword">this</span>.foo = <span class="hljs-number">0</span>;
    }
}
</code></pre>
<p>&#x6CE8;&#x610F;&#xFF0C;<code>--strictPropertyInitialization</code>&#x4F1A;&#x8FDE;&#x540C;&#x5176;&#x5B83;<code>--strict</code>&#x6A21;&#x5F0F;&#x6807;&#x8BB0;&#x4E00;&#x8D77;&#x88AB;&#x542F;&#x7528;&#xFF0C;&#x8FD9;&#x53EF;&#x80FD;&#x4F1A;&#x5F71;&#x54CD;&#x4F60;&#x7684;&#x5DE5;&#x7A0B;&#x3002;
&#x4F60;&#x53EF;&#x4EE5;&#x5728;<code>tsconfig.json</code>&#x7684;<code>compilerOptions</code>&#x91CC;&#x5C06;<code>strictPropertyInitialization</code>&#x8BBE;&#x7F6E;&#x4E3A;<code>false</code>&#xFF0C;
&#x6216;&#x8005;&#x5728;&#x547D;&#x4EE4;&#x884C;&#x4E0A;&#x5C06;<code>--strictPropertyInitialization</code>&#x8BBE;&#x7F6E;&#x4E3A;<code>false</code>&#x6765;&#x5173;&#x95ED;&#x68C0;&#x67E5;&#x3002;</p>
<h2 id="&#x663E;&#x5F0F;&#x8D4B;&#x503C;&#x65AD;&#x8A00;">&#x663E;&#x5F0F;&#x8D4B;&#x503C;&#x65AD;&#x8A00;</h2>
<p>&#x5C3D;&#x7BA1;&#x6211;&#x4EEC;&#x5C1D;&#x8BD5;&#x5C06;&#x7C7B;&#x578B;&#x7CFB;&#x7EDF;&#x505A;&#x7684;&#x66F4;&#x5BCC;&#x8868;&#x73B0;&#x529B;&#xFF0C;&#x4F46;&#x6211;&#x4EEC;&#x77E5;&#x9053;&#x6709;&#x65F6;&#x7528;&#x6237;&#x6BD4;TypeScript&#x66F4;&#x52A0;&#x4E86;&#x89E3;&#x7C7B;&#x578B;&#x3002;</p>
<p>&#x4E0A;&#x9762;&#x63D0;&#x5230;&#x8FC7;&#xFF0C;&#x663E;&#x5F0F;&#x8D4B;&#x503C;&#x65AD;&#x8A00;&#x662F;&#x4E00;&#x4E2A;&#x65B0;&#x8BED;&#x6CD5;&#xFF0C;&#x4F7F;&#x7528;&#x5B83;&#x6765;&#x544A;&#x8BC9;TypeScript&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x4F1A;&#x88AB;&#x660E;&#x786E;&#x5730;&#x8D4B;&#x503C;&#x3002;
&#x4F46;&#x662F;&#x9664;&#x4E86;&#x5728;&#x7C7B;&#x5C5E;&#x6027;&#x4E0A;&#x4F7F;&#x7528;&#x5B83;&#x4E4B;&#x5916;&#xFF0C;&#x5728;TypeScript 2.7&#x91CC;&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x5728;&#x53D8;&#x91CF;&#x58F0;&#x660E;&#x4E0A;&#x4F7F;&#x7528;&#x5B83;&#xFF01;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> x!: <span class="hljs-built_in">number</span>[];
initialize();
x.push(<span class="hljs-number">4</span>);

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">initialize</span>(<span class="hljs-params"></span>) </span>{
    x = [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>];
}
</code></pre>
<p>&#x5047;&#x8BBE;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x5728;<code>x</code>&#x540E;&#x9762;&#x52A0;&#x4E0A;&#x611F;&#x53F9;&#x53F7;&#xFF0C;&#x90A3;&#x4E48;TypeScript&#x4F1A;&#x62A5;&#x544A;<code>x</code>&#x4ECE;&#x672A;&#x88AB;&#x521D;&#x59CB;&#x5316;&#x8FC7;&#x3002;
&#x5B83;&#x5728;&#x5EF6;&#x8FDF;&#x521D;&#x59CB;&#x5316;&#x6216;&#x91CD;&#x65B0;&#x521D;&#x59CB;&#x5316;&#x7684;&#x573A;&#x666F;&#x4E0B;&#x5F88;&#x65B9;&#x4FBF;&#x4F7F;&#x7528;&#x3002;</p>
<h2 id="&#x66F4;&#x4FBF;&#x5229;&#x7684;&#x4E0E;ecmascript&#x6A21;&#x5757;&#x7684;&#x4E92;&#x901A;&#x6027;">&#x66F4;&#x4FBF;&#x5229;&#x7684;&#x4E0E;ECMAScript&#x6A21;&#x5757;&#x7684;&#x4E92;&#x901A;&#x6027;</h2>
<p>ECMAScript&#x6A21;&#x5757;&#x5728;ES2015&#x91CC;&#x624D;&#x88AB;&#x6807;&#x51C6;&#x5316;&#xFF0C;&#x5728;&#x8FD9;&#x4E4B;&#x524D;&#xFF0C;JavaScript&#x751F;&#x6001;&#x7CFB;&#x7EDF;&#x91CC;&#x5B58;&#x5728;&#x51E0;&#x79CD;&#x4E0D;&#x540C;&#x7684;&#x6A21;&#x5757;
&#x683C;&#x5F0F;&#xFF0C;&#x5B83;&#x4EEC;&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F;&#x5404;&#x6709;&#x4E0D;&#x540C;&#x3002;
&#x5F53;&#x65B0;&#x7684;&#x6807;&#x51C6;&#x901A;&#x8FC7;&#x540E;&#xFF0C;&#x793E;&#x533A;&#x9047;&#x5230;&#x4E86;&#x4E00;&#x4E2A;&#x96BE;&#x9898;&#xFF0C;&#x5C31;&#x662F;&#x5982;&#x4F55;&#x5728;&#x5DF2;&#x6709;&#x7684;&#x201C;&#x8001;&#x5F0F;&#x201D;&#x6A21;&#x5757;&#x6A21;&#x5F0F;&#x4E4B;&#x95F4;&#x4FDD;&#x8BC1;&#x6700;&#x4F73;&#x7684;&#x4E92;&#x901A;&#x6027;&#x3002;</p>
<p>TypeScript&#x4E0E;Babel&#x91C7;&#x53D6;&#x4E86;&#x4E0D;&#x540C;&#x7684;&#x65B9;&#x6848;&#xFF0C;&#x5E76;&#x4E14;&#x76F4;&#x5230;&#x73B0;&#x5728;&#xFF0C;&#x8FD8;&#x6CA1;&#x51FA;&#x73B0;&#x771F;&#x6B63;&#x5730;&#x56FA;&#x5B9A;&#x6807;&#x51C6;&#x3002;
&#x7B80;&#x5355;&#x5730;&#x8BF4;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528;Babel&#xFF0C;Webpack&#x6216;React Native&#xFF0C;&#x5E76;&#x671F;&#x671B;&#x4E0E;&#x4F60;&#x4EE5;&#x5F80;&#x4F7F;&#x7528;&#x5730;&#x4E0D;&#x540C;&#x7684;&#x5BFC;&#x5165;&#x884C;&#x4E3A;&#xFF0C;
&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x7F16;&#x8BD1;&#x9009;&#x9879;<code>--esModuleInterop</code>&#x3002;</p>
<p>TypeScript&#x4E0E;Babel&#x90FD;&#x5141;&#x8BB8;&#x7528;&#x6237;&#x5BFC;&#x5165;CommonJS&#x6A21;&#x5757;&#x505A;&#x4E3A;&#x9ED8;&#x8BA4;&#x5BFC;&#x5165;&#xFF0C;&#x4F46;&#x662F;&#x4ECD;&#x7136;&#x5728;&#x5BFC;&#x5165;&#x7684;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x4E0A;&#x63D0;
&#x4F9B;&#x4E86;&#x6BCF;&#x4E2A;&#x5C5E;&#x6027;&#xFF08;&#x9664;&#x975E;&#x6A21;&#x5757;&#x4F7F;&#x7528;&#x4E86;<code>__esModule</code>&#x6807;&#x8BB0;&#xFF09;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> _, { pick } from <span class="hljs-string">&quot;lodash&quot;</span>;

_.pick(...);
pick(...);
</code></pre>
<p>&#x7531;&#x4E8E;TypeScript&#x7684;&#x4E0D;&#x540C;&#x884C;&#x4E3A;&#xFF0C;&#x6211;&#x4EEC;&#x5728;TypeScript 1.8&#x91CC;&#x589E;&#x52A0;&#x4E86;
<code>--allowSyntheticDefaultImports</code>&#x6807;&#x8BB0;&#xFF0C;&#x5141;&#x8BB8;&#x7528;&#x6237;&#x5728;&#x8FD9;&#x79CD;&#x884C;&#x4E3A;&#x4E0B;&#x68C0;&#x67E5;&#x7C7B;&#x578B;&#xFF08;&#x5E76;&#x975E;&#x8F93;&#x51FA;&#xFF09;&#x3002;</p>
<p>&#x901A;&#x5E38;&#xFF0C;&#x5728;TypeScript&#x89C6;&#x89D2;&#x4E0B;&#x7684;CommonJS&#xFF08;&#x548C;AMD&#xFF09;&#x6A21;&#x5757;&#xFF0C;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x5BFC;&#x5165;&#x603B;&#x662F;&#x76F8;&#x5F53;&#x4E8E;CommonJS&#x6A21;&#x5757;&#x5BF9;
&#x8C61;&#x7684;&#x7ED3;&#x6784;&#xFF0C;&#x4E00;&#x4E2A;&#x9ED8;&#x8BA4;&#x5BFC;&#x5165;&#x4EC5;&#x76F8;&#x5F53;&#x4E8E;&#x6A21;&#x5757;&#x4E0A;&#x4E00;&#x4E2A;&#x540D;&#x5B57;&#x53EB;&#x505A;<code>default</code>&#x7684;&#x6210;&#x5458;&#x3002;
&#x5728;&#x8FD9;&#x79CD;&#x5047;&#x5B9A;&#x4E0B;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x5BFC;&#x5165;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> { range } from <span class="hljs-string">&quot;lodash&quot;</span>;

<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i of range(<span class="hljs-number">10</span>)) {
    <span class="hljs-comment">// ...</span>
}
</code></pre>
<p>&#x7136;&#x800C;&#xFF0C;ES&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x5BFC;&#x5165;&#x4E0D;&#x80FD;&#x88AB;&#x8C03;&#x7528;&#xFF0C;&#x56E0;&#x6B64;&#x8FD9;&#x79CD;&#x65B9;&#x6848;&#x5E76;&#x975E;&#x603B;&#x662F;&#x53EF;&#x884C;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> * as express from <span class="hljs-string">&quot;express&quot;</span>;

<span class="hljs-comment">// Should be an error in any valid implementation.</span>
<span class="hljs-keyword">let</span> app = express();
</code></pre>
<p>&#x4E3A;&#x4E86;&#x5141;&#x8BB8;&#x7528;&#x6237;&#x4F7F;&#x7528;&#x4E0E;Babel&#x6216;Webpack&#x4E00;&#x81F4;&#x7684;&#x8FD0;&#x884C;&#x65F6;&#x884C;&#x4E3A;&#xFF0C;TypeScript&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x65B0;&#x7684;
<code>--esModuleInterop</code>&#x6807;&#x8BB0;&#xFF0C;&#x5B83;&#x7528;&#x4E8E;&#x8F93;&#x51FA;&#x65E7;&#x6A21;&#x5757;&#x683C;&#x5F0F;&#x3002;</p>
<p>&#x5F53;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x65B0;&#x7684;<code>--esModuleInterop</code>&#x6807;&#x8BB0;&#x65F6;&#xFF0C;&#x53EF;&#x8C03;&#x7528;&#x7684;CommonJS&#x6A21;&#x5757;&#x5FC5;&#x987B;&#x88AB;&#x505A;&#x4E3A;&#x9ED8;&#x8BA4;&#x5BFC;&#x5165;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> express from <span class="hljs-string">&quot;express&quot;</span>;

<span class="hljs-keyword">let</span> app = express();
</code></pre>
<p>&#x6211;&#x4EEC;&#x5F3A;&#x70C8;&#x5EFA;&#x8BAE;Node.js&#x7528;&#x6237;&#x5229;&#x7528;&#x8FD9;&#x4E2A;&#x6807;&#x8BB0;&#xFF0C;&#x5F53;&#x4E00;&#x4E2A;&#x5E93;&#x7684;&#x6A21;&#x5757;&#x8F93;&#x51FA;&#x76EE;&#x6807;&#x4E3A;commonjs&#x65F6;&#xFF0C;&#x4F8B;&#x5982;express&#xFF0C;&#x5B83;&#x4F1A;&#x5BFC;&#x5165;&#x4E00;&#x4E2A;&#x53EF;&#x8C03;&#x7528;/&#x53EF;&#x6784;&#x9020;&#x7684;&#x6A21;&#x5757;&#x3002;</p>
<p>Webpack&#x7528;&#x6237;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5B83;&#xFF1B;&#x7136;&#x800C;&#xFF0C;&#x4F60;&#x4EEC;&#x4EE3;&#x7801;&#x5E94;&#x8BE5;&#x5C06;&#x76EE;&#x6807;&#x8BBE;&#x7F6E;&#x4E3A;<code>esnext</code>&#x4E14;<code>moduleResolution</code>
&#x7B56;&#x7565;&#x4E3A;<code>node</code>&#x3002;
&#x4F7F;&#x7528;<code>esnext</code>&#x6A21;&#x5757;&#x548C;<code>--esModuleInterop</code>&#x7B49;&#x540C;&#x4E8E;&#x542F;&#x7528;&#x4E86;<code>--allowSyntheticDefaultImports</code>&#x3002;</p>
<h2 id="unique-symbol&#x7C7B;&#x578B;&#x548C;&#x5E38;&#x91CF;&#x540D;&#x5C5E;&#x6027;"><code>unique symbol</code>&#x7C7B;&#x578B;&#x548C;&#x5E38;&#x91CF;&#x540D;&#x5C5E;&#x6027;</h2>
<p>TypeScript 2.7&#x5BF9;ECMAScript&#x91CC;&#x7684;<code>symbols</code>&#x6709;&#x4E86;&#x66F4;&#x6DF1;&#x5165;&#x7684;&#x4E86;&#x89E3;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x66F4;&#x7075;&#x6D3B;&#x5730;&#x4F7F;&#x7528;&#x5B83;&#x4EEC;&#x3002;</p>
<p>&#x4E00;&#x4E2A;&#x9700;&#x6C42;&#x5F88;&#x5927;&#x7684;&#x7528;&#x4F8B;&#x662F;&#x4F7F;&#x7528;<code>symbols</code>&#x6765;&#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#x826F;&#x597D;&#x7684;&#x5C5E;&#x6027;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x770B;&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">const</span> Foo = Symbol(<span class="hljs-string">&quot;Foo&quot;</span>);
<span class="hljs-keyword">const</span> Bar = Symbol(<span class="hljs-string">&quot;Bar&quot;</span>);

<span class="hljs-keyword">let</span> x = {
    [Foo]: <span class="hljs-number">100</span>,
    [Bar]: <span class="hljs-string">&quot;hello&quot;</span>,
};

<span class="hljs-keyword">let</span> a = x[Foo]; <span class="hljs-comment">// has type &apos;number&apos;</span>
<span class="hljs-keyword">let</span> b = x[Bar]; <span class="hljs-comment">// has type &apos;string&apos;</span>
</code></pre>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;TypeScript&#x53EF;&#x4EE5;&#x8FFD;&#x8E2A;&#x5230;<code>x</code>&#x62E5;&#x6709;&#x4F7F;&#x7528;&#x7B26;&#x53F7;<code>Foo</code>&#x548C;<code>Bar</code>&#x58F0;&#x660E;&#x7684;&#x5C5E;&#x6027;&#xFF0C;&#x56E0;&#x4E3A;<code>Foo</code>&#x548C;<code>Bar</code>&#x88AB;&#x58F0;&#x660E;&#x6210;&#x5E38;&#x91CF;&#x3002;
TypeScript&#x5229;&#x7528;&#x4E86;&#x8FD9;&#x4E00;&#x70B9;&#xFF0C;&#x8BA9;<code>Foo</code>&#x548C;<code>Bar</code>&#x5177;&#x6709;&#x4E86;&#x4E00;&#x79CD;&#x65B0;&#x7C7B;&#x578B;&#xFF1A;<code>unique symbols</code>&#x3002;</p>
<p><code>unique symbols</code>&#x662F;<code>symbols</code>&#x7684;&#x5B50;&#x7C7B;&#x578B;&#xFF0C;&#x4EC5;&#x53EF;&#x901A;&#x8FC7;&#x8C03;&#x7528;<code>Symbol()</code>&#x6216;<code>Symbol.for()</code>&#x6216;&#x7531;&#x660E;&#x786E;&#x7684;&#x7C7B;&#x578B;&#x6CE8;&#x91CA;&#x751F;&#x6210;&#x3002;
&#x5B83;&#x4EEC;&#x4EC5;&#x51FA;&#x73B0;&#x5728;&#x5E38;&#x91CF;&#x58F0;&#x660E;&#x548C;&#x53EA;&#x8BFB;&#x7684;&#x9759;&#x6001;&#x5C5E;&#x6027;&#x4E0A;&#xFF0C;&#x5E76;&#x4E14;&#x4E3A;&#x4E86;&#x5F15;&#x7528;&#x4E00;&#x4E2A;&#x5B58;&#x5728;&#x7684;<code>unique symbols</code>&#x7C7B;&#x578B;&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x4F7F;&#x7528;<code>typeof</code>&#x64CD;&#x4F5C;&#x7B26;&#x3002;
&#x6BCF;&#x4E2A;&#x5BF9;<code>unique symbols</code>&#x7684;&#x5F15;&#x7528;&#x90FD;&#x610F;&#x5473;&#x7740;&#x4E00;&#x4E2A;&#x5B8C;&#x5168;&#x552F;&#x4E00;&#x7684;&#x58F0;&#x660E;&#x8EAB;&#x4EFD;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-comment">// Works</span>
<span class="hljs-keyword">declare</span> <span class="hljs-keyword">const</span> Foo: unique symbol;

<span class="hljs-comment">// Error! &apos;Bar&apos; isn&apos;t a constant.</span>
<span class="hljs-keyword">let</span> Bar: unique symbol = Symbol();

<span class="hljs-comment">// Works - refers to a unique symbol, but its identity is tied to &apos;Foo&apos;.</span>
<span class="hljs-keyword">let</span> Baz: <span class="hljs-keyword">typeof</span> Foo = Foo;

<span class="hljs-comment">// Also works.</span>
<span class="hljs-keyword">class</span> C {
    <span class="hljs-keyword">static</span> readonly StaticSymbol: unique symbol = Symbol();
}
</code></pre>
<p>&#x56E0;&#x4E3A;&#x6BCF;&#x4E2A;<code>unique symbols</code>&#x90FD;&#x6709;&#x4E2A;&#x5B8C;&#x5168;&#x72EC;&#x7ACB;&#x7684;&#x8EAB;&#x4EFD;&#xFF0C;&#x56E0;&#x6B64;&#x4E24;&#x4E2A;<code>unique symbols</code>&#x7C7B;&#x578B;&#x4E4B;&#x524D;&#x4E0D;&#x80FD;&#x8D4B;&#x503C;&#x548C;&#x6BD4;&#x8F83;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">const</span> Foo = Symbol();
<span class="hljs-keyword">const</span> Bar = Symbol();

<span class="hljs-comment">// Error: can&apos;t compare two unique symbols.</span>
<span class="hljs-keyword">if</span> (Foo === Bar) {
    <span class="hljs-comment">// ...</span>
}
</code></pre>
<p>&#x53E6;&#x4E00;&#x4E2A;&#x53EF;&#x80FD;&#x7684;&#x7528;&#x4F8B;&#x662F;&#x4F7F;&#x7528;<code>symbols</code>&#x505A;&#x4E3A;&#x8054;&#x5408;&#x6807;&#x8BB0;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-comment">// ./ShapeKind.ts</span>
<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> Circle = Symbol(<span class="hljs-string">&quot;circle&quot;</span>);
<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> Square = Symbol(<span class="hljs-string">&quot;square&quot;</span>);

<span class="hljs-comment">// ./ShapeFun.ts</span>
<span class="hljs-keyword">import</span> * as ShapeKind from <span class="hljs-string">&quot;./ShapeKind&quot;</span>;

<span class="hljs-keyword">interface</span> Circle {
    kind: <span class="hljs-keyword">typeof</span> ShapeKind.Circle;
    radius: <span class="hljs-built_in">number</span>;
}

<span class="hljs-keyword">interface</span> Square {
    kind: <span class="hljs-keyword">typeof</span> ShapeKind.Square;
    sideLength: <span class="hljs-built_in">number</span>;
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">area</span>(<span class="hljs-params">shape: Circle | Square</span>) </span>{
    <span class="hljs-keyword">if</span> (shape.kind === ShapeKind.Circle) {
        <span class="hljs-comment">// &apos;shape&apos; has type &apos;Circle&apos;</span>
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">Math</span>.PI * shape.radius ** <span class="hljs-number">2</span>;
    }
    <span class="hljs-comment">// &apos;shape&apos; has type &apos;Square&apos;</span>
    <span class="hljs-keyword">return</span> shape.sideLength ** <span class="hljs-number">2</span>;
}
</code></pre>
<h2 id="-watch&#x6A21;&#x5F0F;&#x4E0B;&#x5177;&#x6709;&#x66F4;&#x7B80;&#x6D01;&#x7684;&#x8F93;&#x51FA;"><code>--watch</code>&#x6A21;&#x5F0F;&#x4E0B;&#x5177;&#x6709;&#x66F4;&#x7B80;&#x6D01;&#x7684;&#x8F93;&#x51FA;</h2>
<p>&#x5728;TypeScript&#x7684;<code>--watch</code>&#x6A21;&#x5F0F;&#x4E0B;&#x8FDB;&#x884C;&#x91CD;&#x65B0;&#x7F16;&#x8BD1;&#x540E;&#x4F1A;&#x6E05;&#x5C4F;&#x3002;
&#x8FD9;&#x6837;&#x5C31;&#x66F4;&#x65B9;&#x4FBF;&#x9605;&#x8BFB;&#x6700;&#x8FD1;&#x8FD9;&#x6B21;&#x7F16;&#x8BD1;&#x7684;&#x8F93;&#x51FA;&#x4FE1;&#x606F;&#x3002;</p>
<h2 id="&#x66F4;&#x6F02;&#x4EAE;&#x7684;--pretty&#x8F93;&#x51FA;">&#x66F4;&#x6F02;&#x4EAE;&#x7684;<code>--pretty</code>&#x8F93;&#x51FA;</h2>
<p>TypeScript&#x7684;<code>--pretty</code>&#x6807;&#x8BB0;&#x53EF;&#x4EE5;&#x8BA9;&#x9519;&#x8BEF;&#x4FE1;&#x606F;&#x66F4;&#x6613;&#x9605;&#x8BFB;&#x548C;&#x7BA1;&#x7406;&#x3002;
&#x6211;&#x4EEC;&#x5BF9;&#x8FD9;&#x4E2A;&#x529F;&#x80FD;&#x8FDB;&#x884C;&#x4E86;&#x4E24;&#x4E2A;&#x4E3B;&#x8981;&#x7684;&#x6539;&#x8FDB;&#x3002;
&#x9996;&#x5148;&#xFF0C;<code>--pretty</code>&#x5BF9;&#x6587;&#x4EF6;&#x540D;&#xFF0C;&#x8BCA;&#x6BB5;&#x4EE3;&#x7801;&#x548C;&#x884C;&#x6570;&#x6DFB;&#x52A0;&#x4E86;&#x989C;&#x8272;&#xFF08;&#x611F;&#x8C22;Joshua Goldberg&#xFF09;&#x3002;
&#x5176;&#x6B21;&#xFF0C;&#x683C;&#x5F0F;&#x5316;&#x4E86;&#x6587;&#x4EF6;&#x540D;&#x548C;&#x4F4D;&#x7F6E;&#xFF0C;&#x4EE5;&#x53D8;&#x4E8E;&#x5728;&#x5E38;&#x7528;&#x7684;&#x7EC8;&#x7AEF;&#x91CC;&#x4F7F;&#x7528;Ctrl+Click&#xFF0C;Cmd+Click&#xFF0C;Alt+Click&#x7B49;&#x6765;&#x8DF3;&#x8F6C;&#x5230;&#x7F16;&#x8BD1;&#x5668;&#x91CC;&#x7684;&#x76F8;&#x5E94;&#x4F4D;&#x7F6E;&#x3002;</p>
<h2 id="&#x6570;&#x5B57;&#x5206;&#x9694;&#x7B26;">&#x6570;&#x5B57;&#x5206;&#x9694;&#x7B26;</h2>
<p>TypeScript 2.7&#x652F;&#x6301;ECMAScript&#x7684;&#x6570;&#x5B57;&#x5206;&#x9694;&#x7B26;&#x63D0;&#x6848;&#x3002;
&#x8FD9;&#x4E2A;&#x7279;&#x6027;&#x5141;&#x8BB8;&#x7528;&#x6237;&#x5728;&#x6570;&#x5B57;&#x4E4B;&#x95F4;&#x4F7F;&#x7528;&#x4E0B;&#x5212;&#x7EBF;&#xFF08;_&#xFF09;&#x6765;&#x5BF9;&#x6570;&#x5B57;&#x5206;&#x7EC4;&#xFF08;&#x5C31;&#x50CF;&#x4F7F;&#x7528;&#x9017;&#x53F7;&#x548C;&#x70B9;&#x6765;&#x5BF9;&#x6570;&#x5B57;&#x5206;&#x7EC4;&#x90A3;&#x6837;&#xFF09;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-comment">// Constants</span>
<span class="hljs-keyword">const</span> COULOMB = <span class="hljs-number">8.957</span>_551_787e9; <span class="hljs-comment">// N-m^2 / C^2</span>
<span class="hljs-keyword">const</span> PLANCK = <span class="hljs-number">6.626</span>_070_040e<span class="hljs-number">-34</span>; <span class="hljs-comment">// J-s</span>
<span class="hljs-keyword">const</span> JENNY = <span class="hljs-number">867</span>_5309; <span class="hljs-comment">// C-A-L^2</span>
</code></pre>
<p>&#x8FD9;&#x4E9B;&#x5206;&#x9694;&#x7B26;&#x5BF9;&#x4E8E;&#x4E8C;&#x8FDB;&#x5236;&#x548C;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x540C;&#x6837;&#x6709;&#x7528;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> bits = <span class="hljs-number">0b0010</span>_1010;
<span class="hljs-keyword">let</span> routine = <span class="hljs-number">0xC0FFEE</span>_F00D_BED;
<span class="hljs-keyword">let</span> martin = <span class="hljs-number">0xF0</span>_1E_
</code></pre>
<p>&#x6CE8;&#x610F;&#xFF0C;&#x53EF;&#x80FD;&#x6709;&#x4E9B;&#x53CD;&#x5E38;&#x8BC6;&#xFF0C;JavaScript&#x91CC;&#x7684;&#x6570;&#x5B57;&#x8868;&#x793A;&#x4FE1;&#x7528;&#x5361;&#x548C;&#x7535;&#x8BDD;&#x53F7;&#x5E76;&#x4E0D;&#x9002;&#x5F53;&#x3002;
&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#x4F7F;&#x7528;&#x5B57;&#x7B26;&#x4E32;&#x66F4;&#x597D;&#x3002;</p>
<h2 id="&#x56FA;&#x5B9A;&#x957F;&#x5EA6;&#x5143;&#x7EC4;">&#x56FA;&#x5B9A;&#x957F;&#x5EA6;&#x5143;&#x7EC4;</h2>
<p>TypeScript 2.6&#x4E4B;&#x524D;&#xFF0C;<code>[number, string, string]</code>&#x88AB;&#x5F53;&#x4F5C;<code>[number, string]</code>&#x7684;&#x5B50;&#x7C7B;&#x578B;&#x3002;
&#x8FD9;&#x662F;&#x7531;&#x4E8E;TypeScript&#x7684;&#x7ED3;&#x6784;&#x6027;&#x7C7B;&#x578B;&#x7CFB;&#x7EDF;&#x800C;&#x9020;&#x6210;&#x7684;&#xFF1B;
<code>[number, string, string]</code>&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x548C;&#x7B2C;&#x4E8C;&#x4E2A;&#x5143;&#x7D20;&#x662F;<code>[number, string]</code>&#x91CC;&#x76F8;&#x5E94;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x548C;&#x7B2C;
&#x4E8C;&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x5B50;&#x7C7B;&#x578B;&#xFF0C;&#x5E76;&#x4E14;&#x201C;&#x672B;&#x5C3E;&#x7684;&#x201D;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;&#x662F;&#x53EF;&#x4EE5;&#x8D4B;&#x503C;&#x7ED9;<code>[number, string]</code>&#x91CC;&#x5143;&#x7D20;&#x7684;&#x8054;&#x5408;&#x7C7B;&#x578B;&#x7684;&#x3002;
&#x7136;&#x800C;&#xFF0C;&#x5728;&#x67E5;&#x770B;&#x4E86;&#x73B0;&#x5B9E;&#x4E2D;&#x5143;&#x7EC4;&#x7684;&#x771F;&#x5B9E;&#x7528;&#x6CD5;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x6CE8;&#x610F;&#x5230;&#x5927;&#x591A;&#x6570;&#x60C5;&#x51B5;&#x4E0B;&#x8FD9;&#x662F;&#x4E0D;&#x88AB;&#x5141;&#x8BB8;&#x7684;&#x3002;</p>
<p>&#x611F;&#x8C22;Tycho Grouwstra&#x63D0;&#x4EA4;&#x7684;PR&#xFF0C;&#x5143;&#x7EC4;&#x7C7B;&#x578B;&#x4F1A;&#x8003;&#x8651;&#x5B83;&#x7684;&#x957F;&#x5EA6;&#xFF0C;&#x4E0D;&#x540C;&#x957F;&#x5EA6;&#x7684;&#x5143;&#x7EC4;&#x4E0D;&#x518D;&#x5141;&#x8BB8;&#x76F8;&#x4E92;&#x8D4B;&#x503C;&#x3002;
&#x5B83;&#x901A;&#x8FC7;&#x6570;&#x5B57;&#x5B57;&#x9762;&#x91CF;&#x7C7B;&#x578B;&#x5B9E;&#x73B0;&#xFF0C;&#x56E0;&#x6B64;&#x73B0;&#x5728;&#x53EF;&#x4EE5;&#x533A;&#x5206;&#x51FA;&#x4E0D;&#x540C;&#x957F;&#x5EA6;&#x7684;&#x5143;&#x7EC4;&#x4E86;&#x3002;</p>
<p>&#x6982;&#x5FF5;&#x4E0A;&#x8BB2;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x628A;<code>[number, string]</code>&#x7C7B;&#x578B;&#x7B49;&#x540C;&#x4E8E;&#x4E0B;&#x9762;&#x7684;<code>NumStrTuple</code>&#x58F0;&#x660E;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">interface</span> NumStrTuple <span class="hljs-keyword">extends</span> Array&lt;number | string&gt; {
    <span class="hljs-number">0</span>: <span class="hljs-built_in">number</span>;
    <span class="hljs-number">1</span>: <span class="hljs-built_in">string</span>;
    length: <span class="hljs-number">2</span>; <span class="hljs-comment">// using the numeric literal type &apos;2&apos;</span>
}
</code></pre>
<p>&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x7834;&#x574F;&#x6027;&#x6539;&#x52A8;&#x3002;
&#x5982;&#x679C;&#x4F60;&#x60F3;&#x8981;&#x4EE5;&#x524D;&#x7684;&#x884C;&#x4E3A;&#xFF0C;&#x8BA9;&#x5143;&#x7EC4;&#x4EC5;&#x9650;&#x5236;&#x6700;&#x5C0F;&#x7684;&#x957F;&#x5EA6;&#xFF0C;&#x90A3;&#x4E48;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x7C7B;&#x4F3C;&#x7684;&#x58F0;&#x660E;&#x4F46;&#x4E0D;&#x660E;&#x786E;&#x5730;&#x6307;&#x5B9A;&#x957F;
&#x5EA6;&#x5C5E;&#x6027;&#xFF0C;&#x56DE;&#x9000;&#x5230;&#x6570;&#x5B57;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">interface</span> MinimumNumStrTuple <span class="hljs-keyword">extends</span> Array&lt;number | string&gt; {
    <span class="hljs-number">0</span>: <span class="hljs-built_in">number</span>;
    <span class="hljs-number">1</span>: <span class="hljs-built_in">string</span>;
}
</code></pre>
<h2 id="in&#x64CD;&#x4F5C;&#x7B26;&#x7EC6;&#x5316;&#x548C;&#x7CBE;&#x786E;&#x7684;instanceof"><code>in</code>&#x64CD;&#x4F5C;&#x7B26;&#x7EC6;&#x5316;&#x548C;&#x7CBE;&#x786E;&#x7684;<code>instanceof</code></h2>
<p>TypeScript 2.7&#x5E26;&#x6765;&#x4E86;&#x4E24;&#x5904;&#x7C7B;&#x578B;&#x7EC6;&#x5316;&#x65B9;&#x9762;&#x7684;&#x6539;&#x52A8; - &#x901A;&#x8FC7;&#x6267;&#x884C;&#x201C;&#x7C7B;&#x578B;&#x4FDD;&#x62A4;&#x201D;&#x786E;&#x5B9A;&#x66F4;&#x8BE6;&#x7EC6;&#x7C7B;&#x578B;&#x7684;&#x80FD;&#x529B;&#x3002;</p>
<p>&#x9996;&#x5148;&#xFF0C;<code>instanceof</code>&#x64CD;&#x4F5C;&#x7B26;&#x73B0;&#x5728;&#x5229;&#x7528;&#x7EE7;&#x627F;&#x94FE;&#x800C;&#x975E;&#x4F9D;&#x8D56;&#x4E8E;&#x7ED3;&#x6784;&#x517C;&#x5BB9;&#x6027;&#xFF0C;
&#x80FD;&#x66F4;&#x51C6;&#x786E;&#x5730;&#x53CD;&#x6620;&#x51FA;<code>instanceof</code>&#x64CD;&#x4F5C;&#x7B26;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x7684;&#x884C;&#x4E3A;&#x3002;
&#x8FD9;&#x53EF;&#x4EE5;&#x5E2E;&#x52A9;&#x907F;&#x514D;&#x4E00;&#x4E9B;&#x590D;&#x6742;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x5F53;&#x4F7F;&#x7528;<code>instanceof</code>&#x53BB;&#x7EC6;&#x5316;&#x7ED3;&#x6784;&#x4E0A;&#x76F8;&#x4F3C;&#xFF08;&#x4F46;&#x65E0;&#x5173;&#xFF09;&#x7684;&#x7C7B;&#x578B;&#x65F6;&#x3002;</p>
<p>&#x5176;&#x6B21;&#xFF0C;&#x611F;&#x8C22;GitHub&#x7528;&#x6237;IdeaHunter&#xFF0C;<code>in</code>&#x64CD;&#x4F5C;&#x7B26;&#x73B0;&#x5728;&#x505A;&#x4E3A;&#x7C7B;&#x578B;&#x4FDD;&#x62A4;&#x4F7F;&#x7528;&#xFF0C;&#x4F1A;&#x7EC6;&#x5316;&#x6389;&#x6CA1;&#x6709;&#x660E;&#x786E;&#x58F0;&#x660E;&#x7684;&#x5C5E;&#x6027;&#x540D;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">interface</span> A { a: <span class="hljs-built_in">number</span> };
<span class="hljs-keyword">interface</span> B { b: <span class="hljs-built_in">string</span> };

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">foo</span>(<span class="hljs-params">x: A | B</span>) </span>{
    <span class="hljs-keyword">if</span> (<span class="hljs-string">&quot;a&quot;</span> <span class="hljs-keyword">in</span> x) {
        <span class="hljs-keyword">return</span> x.a;
    }
    <span class="hljs-keyword">return</span> x.b;
}
</code></pre>
<h2 id="&#x66F4;&#x667A;&#x80FD;&#x7684;&#x5BF9;&#x8C61;&#x5B57;&#x9762;&#x91CF;&#x63A8;&#x65AD;">&#x66F4;&#x667A;&#x80FD;&#x7684;&#x5BF9;&#x8C61;&#x5B57;&#x9762;&#x91CF;&#x63A8;&#x65AD;</h2>
<p>&#x5728;JavaScript&#x91CC;&#x6709;&#x4E00;&#x79CD;&#x6A21;&#x5F0F;&#xFF0C;&#x7528;&#x6237;&#x4F1A;&#x5FFD;&#x7565;&#x6389;&#x4E00;&#x4E9B;&#x5C5E;&#x6027;&#xFF0C;&#x7A0D;&#x540E;&#x5728;&#x4F7F;&#x7528;&#x7684;&#x65F6;&#x5019;&#x90A3;&#x4E9B;&#x5C5E;&#x6027;&#x7684;&#x503C;&#x4E3A;<code>undefined</code>&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> foo = someTest ? { value: <span class="hljs-number">42</span> } : {};
</code></pre>
<p>&#x5728;&#x4EE5;&#x524D;TypeScript&#x4F1A;&#x67E5;&#x627E;<code>{ value: number }</code>&#x548C;<code>{}</code>&#x7684;&#x6700;&#x4F73;&#x8D85;&#x7C7B;&#x578B;&#xFF0C;&#x7ED3;&#x679C;&#x662F;<code>{}</code>&#x3002;
&#x8FD9;&#x4ECE;&#x6280;&#x672F;&#x89D2;&#x5EA6;&#x4E0A;&#x8BB2;&#x662F;&#x6B63;&#x786E;&#x7684;&#xFF0C;&#x4F46;&#x5E76;&#x4E0D;&#x662F;&#x5F88;&#x6709;&#x7528;&#x3002;</p>
<p>&#x4ECE;2.7&#x7248;&#x672C;&#x5F00;&#x59CB;&#xFF0C;TypeScript&#x4F1A;&#x201C;&#x89C4;&#x8303;&#x5316;&#x201D;&#x6BCF;&#x4E2A;&#x5BF9;&#x8C61;&#x5B57;&#x9762;&#x91CF;&#x7C7B;&#x578B;&#x8BB0;&#x5F55;&#x6BCF;&#x4E2A;&#x5C5E;&#x6027;&#xFF0C;
&#x4E3A;&#x6BCF;&#x4E2A;<code>undefined</code>&#x7C7B;&#x578B;&#x5C5E;&#x6027;&#x63D2;&#x5165;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x5C5E;&#x6027;&#xFF0C;&#x5E76;&#x5C06;&#x5B83;&#x4EEC;&#x8054;&#x5408;&#x8D77;&#x6765;&#x3002;</p>
<p>&#x5728;&#x4E0A;&#x4F8B;&#x4E2D;&#xFF0C;<code>foo</code>&#x7684;&#x6700;&#x7C7B;&#x578B;&#x662F;<code>{ value: number } | { value?: undefined }</code>&#x3002;
&#x7ED3;&#x5408;&#x4E86;TypeScript&#x7684;&#x7EC6;&#x5316;&#x7C7B;&#x578B;&#xFF0C;&#x8FD9;&#x8BA9;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x7F16;&#x5199;&#x66F4;&#x5177;&#x8868;&#x8FBE;&#x6027;&#x7684;&#x4EE3;&#x7801;&#x4E14;TypeScript&#x4E5F;&#x53EF;&#x7406;&#x89E3;&#x3002;
&#x770B;&#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-comment">// Has type</span>
<span class="hljs-comment">//  | { a: boolean, aData: number, b?: undefined }</span>
<span class="hljs-comment">//  | { b: boolean, bData: string, a?: undefined }</span>
<span class="hljs-keyword">let</span> bar = <span class="hljs-built_in">Math</span>.random() &lt; <span class="hljs-number">0.5</span> ?
    { a: <span class="hljs-literal">true</span>, aData: <span class="hljs-number">100</span> } :
    { b: <span class="hljs-literal">true</span>, bData: <span class="hljs-string">&quot;hello&quot;</span> };

<span class="hljs-keyword">if</span> (bar.b) {
    <span class="hljs-comment">// TypeScript now knows that &apos;bar&apos; has the type</span>
    <span class="hljs-comment">//</span>
    <span class="hljs-comment">//   &apos;{ b: boolean, bData: string, a?: undefined }&apos;</span>
    <span class="hljs-comment">//</span>
    <span class="hljs-comment">// so it knows that &apos;bData&apos; is available.</span>
    bar.bData.toLowerCase()
}
</code></pre>
<p>&#x8FD9;&#x91CC;&#xFF0C;TypeScript&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x68C0;&#x67E5;<code>b</code>&#x5C5E;&#x6027;&#x6765;&#x7EC6;&#x5316;<code>bar</code>&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x7136;&#x540E;&#x5141;&#x8BB8;&#x6211;&#x4EEC;&#x8BBF;&#x95EE;<code>bData</code>&#x5C5E;&#x6027;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="TypeScript 2.8.html" class="navigation navigation-prev " aria-label="Previous page: TypeScript 2.8">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="TypeScript 2.6.html" class="navigation navigation-next " aria-label="Next page: TypeScript 2.6">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"TypeScript 2.7","level":"1.7.5","depth":2,"next":{"title":"TypeScript 2.6","level":"1.7.6","depth":2,"path":"doc/release-notes/TypeScript 2.6.md","ref":"./doc/release-notes/TypeScript 2.6.md","articles":[]},"previous":{"title":"TypeScript 2.8","level":"1.7.4","depth":2,"path":"doc/release-notes/TypeScript 2.8.md","ref":"./doc/release-notes/TypeScript 2.8.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Patrick Zhong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"preface.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"TypeScript Handbook","language":"zh-hans","gitbook":">3.0.0","description":"Translation of official TypeScript Handbook"},"file":{"path":"doc/release-notes/TypeScript 2.7.md","mtime":"2018-10-13T09:48:54.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-13T09:57:42.904Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

